package alg1_baseModel;
//编写一段代码，打印出一个二维布尔数组的内容。其中，使用＊表示真，空格表示假。打印出行号和列号。
public class Test1_1_11 {
    public static void main(String[] args) {
        boolean[][] boolArray = {
                {true,false,false,true},
                {true,false,false,true},
                {true,false,false,true,false,true}};

        //计算最多有多少列
        int col = 0;
        for (int i = 0; i < boolArray.length; i++) {
            boolean[] arr1 = boolArray[i];
            if(arr1.length > col){
                col = arr1.length;
            }
        }
        //打印列号
        System.out.print(" ");
        for (int i = 0; i < col; i++) {
            System.out.print(i);
        }
        System.out.println();

        //打印行号和内容
        for (int i = 0; i < boolArray.length; i++) {
            boolean[] arr1 = boolArray[i];
            System.out.print(i);
            for (int j = 0; j < arr1.length; j++) {
                boolean[] arr2 = boolArray[i];
                System.out.print(arr2[j] == true ? "*" : "#");
            }
            System.out.println();
        }
    }
}
